/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package dacnpm;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JLabel;
import dacnpm.Form_DangThi;
import dacnpm.Form_ThongBaoDiemThi;
import java.nio.Buffer;
import java.nio.IntBuffer;
/**
 *
 * @author AnhNguy
 */
public class Clock  extends Thread{
   
    JLabel lblTime;
    public static int i=2700;
    public static int j=0;
     Form_DangThi dangthi;
    public Clock(JLabel lblTime) throws Exception{
       
        this.lblTime = lblTime;
    }
  
    @SuppressWarnings("static-access")
public Clock(int a){
  this.i = a;
}
   
    @Override
        public void run()
        {
       
        while(i>0){
            i--;
           int minute = i/60;
          int Second = i -minute*60;
          String time  =  minute+":"+Second;
          if(Second<10){
          time =minute+":0"+Second;
          }
         // System.out.println(j);
          lblTime.setText(time);
          try {
                   j++;
                    Thread.sleep(1000);
                } catch (InterruptedException ex) {

              }
            }
        if(i==0){
            
           
        }
        stop();
       // boolean dung =true;
//        if(i==0){
//            --i;
//         try {
//            dangthi= new Form_DangThi();
//            dangthi.chamdiem(); 
//             
//        } catch (Exception ex) {
//            Logger.getLogger(Form_DangThi.class.getName()).log(Level.SEVERE, null, ex);
//        }
//            dangthi.setVisible(false);
//            Form_ThongBaoDiemThi t = new Form_ThongBaoDiemThi();
//            t.setVisible(true);
//            t.setLocation(200, 200);
//            dangthi.setEnabled(false);
//        
//        }
    
        }
       
//   public void reset(){
//   i =600;
//   j=0;
//   }
//    public static String TimePlay(){
//          int minute = j/60;
//          int Second = j -minute*60;
//          //String time  =  minute+":"+Second;
//          String time  =  minute+":"+Second;
//          if(Second<10){
//          time =minute+":0"+Second;
//          }
//          return time;
//    }
     

     

}
